import {
  getData,
  postData,
  deleteData,
} from "@/api/common/index";

const baseOfflineServiceProvider = "/api/offline-service-provider";

const OfflineServiceProviderUrl = {
  page: "/page",
  url: "",
  addInfo: "/addInfo",
  approve: '/approve',
};

export function getOfflineServiceProviderPage(params: any, pageNo: number | null | undefined, pageSize : number | null| undefined): Promise<any> {
  let url = baseOfflineServiceProvider + OfflineServiceProviderUrl.page + "?pageNum=" + (pageNo ? pageNo : 1) + "&pageSize=" + (pageSize ? pageSize : 10);
  return postData(url, params);
}

export function getOfflineServiceProviderDetail(id: number): Promise<any> {
  return getData(baseOfflineServiceProvider + OfflineServiceProviderUrl.url + "?id=" + id);
}

export function deleteOfflineServiceProvider(ids: string) : Promise<any>{
  return deleteData(baseOfflineServiceProvider + OfflineServiceProviderUrl.url + "?ids=" + ids);
}

export function approveOfflineServiceProvider(params: any) : Promise<any>{
  return getData(baseOfflineServiceProvider + OfflineServiceProviderUrl.approve, params);
}

export function addOrEditOfflineServiceProvider(
  method: string,
  params: any
): Promise<any> {
    console.log('1111', method);
    return postData(baseOfflineServiceProvider +  OfflineServiceProviderUrl.addInfo, params);
}
